﻿/*
   @Author: P. Senjic
   @Date: 8.9.2013
   @Comment:
    UI-Events and other page-specific stuff is declared in here.
*/
(function () {
    "use strict";


    WinJS.UI.Pages.define("/pages/home/home.html", {
        // This function is called whenever a user navigates to this page. It
        // populates the page elements with the app's data.
        ready: function (element, options) {
            // TODO: Initialize the page here.

            AddCategory.addEventListener("MSPointerDown", onPointerDownAddCategory, false);
            AddCategory.addEventListener("MSPointerUp", onPointerUpAddCategory, false);
            /*
                Mein Versuch 
           */
            My_first_Try.addEventListener("MSPointerDown", onPointerDownMy_first_Try, false);
            My_first_Try.addEventListener("MSPointerUp", onPointerUpMy_first_Try, false);

            mainsection.style.opacity = "0";

            runEnterPageAnimation();
        }
    });

    function onPointerDownAddCategory(evt) {
        WinJS.UI.Animation.pointerDown(AddCategory);
    }

    function onPointerUpAddCategory(evt) {
        WinJS.UI.Animation.pointerUp(AddCategory);
        WinJS.Navigation.navigate("/pages/administrative/taskAddCategory.html", null);

    }

    /*
    Mein Versuch 
    */
    function onPointerDownMy_first_Try(evt) {
        WinJS.UI.Animation.pointerDown(My_first_Try);
    }
    /*
    Korregieren
    */
    function onPointerUpMy_first_Try(evt) {
        WinJS.UI.Animation.pointerUp(My_first_Try);
        WinJS.Navigation.navigate("/pages/views/list/list.html", null);

    }
    /*
    */

    function runEnterPageAnimation() {
        mainsection.style.overflow = "hidden";
        // Animate the application's entrance in the number of stages chosen by the user
        // Use the recommended offset by leaving the offset argument empty to get the best performance
        var enterContent;
        WinJS.Promise.timeout(2000);
        enterContent = WinJS.UI.Animation.enterContent(mainsection, null);

        enterContent.done(
            function () {
                mainsection.style.overflow = "auto";
            });
    }
})();
